/*
 * Created on Jun 2, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.jjprojects.earutility;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Date;

import javax.swing.JOptionPane;


/**
 * @author U678864
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TextReportCreator
{
    String strFirstFileNameForReport = null;
    String strSecondFileNameForReport = null;
    
    public static final String STR_TAB = "\t";
    public static final String STR_SINGLE_LINE = "\r\n";
    public static final String STR_DOUBLE_LINE = "\r\n";
    public static final String STR_STAR_LINE = "*****************************************************************************************************************";
    public static final String STR_DASH_LINE = "-----------------------------------------------------------------------------------------------------------------";
    
    private StringBuffer strbufTextReport;

    private EARFilesComparingTool objEARFilesComparingTool = null;
    
    private boolean boolSimilarFiles = false;
    private boolean boolChangedFiles = false;
    private boolean boolMissingFiles = false;
    
    private int intBigFirstFileContentLength;
    private int intBigSecondFileContentLength;
    
    public TextReportCreator(EARFilesComparingTool objEARFilesComparingTool)
    {
        this.objEARFilesComparingTool = objEARFilesComparingTool;
    }
    
    public void generateTextReport(String strTextReportFile)
    {
        boolSimilarFiles = objEARFilesComparingTool.chkSimilarFiles.isSelected();
        boolChangedFiles = objEARFilesComparingTool.chkChangedFiles.isSelected();
        boolMissingFiles = objEARFilesComparingTool.chkMissingFiles.isSelected();
        
        String strCurrentRecord = null;
        strbufTextReport = new StringBuffer(10000);
        
        //Adding Header Part
        strbufTextReport.append("                     EAR FILES COMPARE  DETAILS                     ");
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_STAR_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        
        //Adding Basic Body Content
        generateBasicDetails();
        
        if(boolMissingFiles)
        {
            generateMissingFileDetails();
        }
        
        if(boolChangedFiles)
        {
            generateChangedFileDetails();
        }
        
        if(boolSimilarFiles)
        {
            generateSimilarFileDetails();
        }
        
        generateAllFilesDetails();
        
        try
        {
            File fileToSave = new File(strTextReportFile);
            FileOutputStream fi = new FileOutputStream(fileToSave);
            PrintWriter pw = new PrintWriter(fi);
            
            pw.println(strbufTextReport); 
            pw.flush();
            pw.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        
        int intDialogSelection = JOptionPane.showConfirmDialog(objEARFilesComparingTool.dlgReportSelection, 
                "The report is generated\nDo you want to open it now", "Open Text Report File", JOptionPane.YES_NO_OPTION);
        
        if(intDialogSelection == 0)
        {
            objEARFilesComparingTool.dlgReportSelection.setVisible(false);
            String cmd = "cmd /c start notepad \""+ strTextReportFile + "\"";
            try
            {
                Runtime.getRuntime().exec(cmd);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
        }
        
    }
    
    
    public void generateTextLinkMenu(int intSelectedIndex)
    {
        if(intSelectedIndex == 1)
        {
            strbufTextReport.append("<a name='basicdetails'/>");
            strbufTextReport.append("<table bgcolor='#77BBBB' width='100%' border='0' cellpadding='2' cellspacing='1'>");
            strbufTextReport.append("<tr bgcolor='#77BBBB' align='center'>");
            strbufTextReport.append("<td width='1%' bgcolor=''><font size = '2' color='#ffffff'>Basic Details</font></td>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View All File Details' href='#alldetails'><font size = '2' color='#ffffff'>All File Details</font></a>");
            strbufTextReport.append("</td>");
            if(boolMissingFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Missing File Details' href='#missedfiledetails'><font size = '2' color='#ffffff'>Missing File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolChangedFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Changed File Details' href='#changedfiledetails'><font size = '2' color='#ffffff'>Changed File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolSimilarFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Similar File Details' href='#similarfiledetails'><font size = '2' color='#ffffff'>Similar File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            strbufTextReport.append("</tr></table>");
        }
        else if(intSelectedIndex == 2)
        {
            strbufTextReport.append("<a name='alldetails'/>");
            strbufTextReport.append("<table bgcolor='#77BBBB' width='100%' border='0' cellpadding='2' cellspacing='1'>");
            strbufTextReport.append("<tr bgcolor='#77BBBB' align='center'>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View Basic Details' href='#basicdetails'><font size = '2' color='#ffffff'>Basic Details</font></a>");
            strbufTextReport.append("</td>");
            strbufTextReport.append("<td width='1%' bgcolor=''><font size = '2' color='#ffffff'>All File Details</font></td>");
            if(boolMissingFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Missing File Details' href='#missedfiledetails'><font size = '2' color='#ffffff'>Missing File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolChangedFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Changed File Details' href='#changedfiledetails'><font size = '2' color='#ffffff'>Changed File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolSimilarFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Similar File Details' href='#similarfiledetails'><font size = '2' color='#ffffff'>Similar File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            strbufTextReport.append("</tr></table>");
        }
        else if(intSelectedIndex == 3)
        {
            strbufTextReport.append("<a name='missedfiledetails'/>");
            strbufTextReport.append("<table bgcolor='#77BBBB' width='100%' border='0' cellpadding='2' cellspacing='1'>");
            strbufTextReport.append("<tr bgcolor='#77BBBB' align='center'>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View Basic Details' href='#basicdetails'><font size = '2' color='#ffffff'>Basic Details</font></a>");
            strbufTextReport.append("</td>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View All File Details' href='#alldetails'><font size = '2' color='#ffffff'>All File Details</font></a>");
            strbufTextReport.append("</td>");
            if(boolMissingFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor=''><font size = '2' color='#ffffff'>Missing File Details</font></td>");
            }
            if(boolChangedFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Changed File Details' href='#changedfiledetails'><font size = '2' color='#ffffff'>Changed File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolSimilarFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Similar File Details' href='#similarfiledetails'><font size = '2' color='#ffffff'>Similar File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            strbufTextReport.append("</tr></table>");
        }
        else if(intSelectedIndex == 4)
        {
            strbufTextReport.append("<a name='changedfiledetails'/>");
            strbufTextReport.append("<table bgcolor='#77BBBB' width='100%' border='0' cellpadding='2' cellspacing='1'>");
            strbufTextReport.append("<tr bgcolor='#77BBBB' align='center'>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View Basic Details' href='#basicdetails'><font size = '2' color='#ffffff'>Basic Details</font></a>");
            strbufTextReport.append("</td>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View All File Details' href='#alldetails'><font size = '2' color='#ffffff'>All File Details</font></a>");
            strbufTextReport.append("</td>");
            if(boolMissingFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Missing File Details' href='#missedfiledetails'><font size = '2' color='#ffffff'>Missing File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolChangedFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor=''><font size = '2' color='#ffffff'>Changed File Details</font></td>");
            }
            if(boolSimilarFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Similar File Details' href='#similarfiledetails'><font size = '2' color='#ffffff'>Similar File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            strbufTextReport.append("</tr></table>");
        }
        else if(intSelectedIndex == 5)
        {
            strbufTextReport.append("<a name='similarfiledetails'/>");
            strbufTextReport.append("<table bgcolor='#77BBBB' width='100%' border='0' cellpadding='2' cellspacing='1'>");
            strbufTextReport.append("<tr bgcolor='#77BBBB' align='center'>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View Basic Details' href='#basicdetails'><font size = '2' color='#ffffff'>Basic Details</font></a>");
            strbufTextReport.append("</td>");
            strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
            strbufTextReport.append("<a title='View All File Details' href='#alldetails'><font size = '2' color='#ffffff'>All File Details</font></a>");
            strbufTextReport.append("</td>");
            if(boolMissingFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Missing File Details' href='#missedfiledetails'><font size = '2' color='#ffffff'>Missing File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolChangedFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor='#93A685'>");
                strbufTextReport.append("<a title='View Changed File Details' href='#changedfiledetails'><font size = '2' color='#ffffff'>Changed File Details</font></a>");
                strbufTextReport.append("</td>");
            }
            if(boolSimilarFiles)
            {
                strbufTextReport.append("<td width='1%' bgcolor=''><font size = '2' color='#ffffff'>Similar File Details</font></td>");
            }
            strbufTextReport.append("</tr></table>");
        }
        strbufTextReport.append("<br>");
    }
    
    
    public void generateBasicDetails()
    {
        objEARFilesComparingTool.intSimilarFileCount = 0;
        objEARFilesComparingTool.intModifiedFileCount = 0;
        objEARFilesComparingTool.intMissingFirstFileCount = 0;
        objEARFilesComparingTool.intMissingSecondFileCount = 0;
        //Getting the Basic Details
        int intSize = objEARFilesComparingTool.vecEqualityStatus.size();
        String strFileCompareStatus = null;
        String strFirstFileContent = null;
        String strSecondFileContent = null;
        
        int intFirstFileContentLength = 0;
        intBigFirstFileContentLength = 0;
        
        int intSecondFileContentLength = 0;
        intBigSecondFileContentLength = 0;
        
        for(int i=0;i<intSize;i++)
        {
            strFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            
            strFirstFileContent = objEARFilesComparingTool.vecFirstEARFilesContent.get(i).toString();
            intFirstFileContentLength = strFirstFileContent.length();
            if(intFirstFileContentLength > intBigFirstFileContentLength)
            {
                intBigFirstFileContentLength = intFirstFileContentLength;
            }
            
            strSecondFileContent = objEARFilesComparingTool.vecSecondEARFilesContent.get(i).toString();
            intSecondFileContentLength = strSecondFileContent.length();
            if(intSecondFileContentLength > intBigSecondFileContentLength)
            {
                intBigSecondFileContentLength = intSecondFileContentLength;
            }
            
            if(strFileCompareStatus.equals("EQUAL"))
            {
                objEARFilesComparingTool.intSimilarFileCount++;
            }
            else if(strFileCompareStatus.equals("NOT EQUAL"))
            {
                objEARFilesComparingTool.intModifiedFileCount++;
            }
            else if(strFileCompareStatus.equals("FILE MISSING"))
            {
                String strStatusDetails = objEARFilesComparingTool.vecEqualityStatusDetails.get(i).toString();
                if(strStatusDetails.endsWith("First JAR file"))
                {
                    objEARFilesComparingTool.intMissingFirstFileCount++;
                }
                else if(strStatusDetails.endsWith("Second JAR file"))
                {
                    objEARFilesComparingTool.intMissingSecondFileCount++;
                }
            }
        }
        
        if(objEARFilesComparingTool.strFirstParentFileName.trim().length() == 0)
        {
            strFirstFileNameForReport = objEARFilesComparingTool.strGlobleFirstEARFileName;
        }
        else
        {
            int intFirstFileLastIndex = objEARFilesComparingTool.strGlobleFirstEARFileName.lastIndexOf("\\");
            String strOnlyCurrentFirstFileName = objEARFilesComparingTool.strGlobleFirstEARFileName.substring(intFirstFileLastIndex);
            if(!(objEARFilesComparingTool.strGlobleFirstEARFileName.endsWith(strOnlyCurrentFirstFileName)))
            {
                strFirstFileNameForReport = objEARFilesComparingTool.strFirstParentFileName + strOnlyCurrentFirstFileName;
            }
            else
            {
                strFirstFileNameForReport = objEARFilesComparingTool.strFirstParentFileName;
            }
        }
        if(objEARFilesComparingTool.strSecondParentFileName.trim().length() == 0)
        {
            strSecondFileNameForReport = objEARFilesComparingTool.strGlobleSecondEARFileName;
        }
        else
        {
            int intSecondFileLastIndex = objEARFilesComparingTool.strGlobleSecondEARFileName.lastIndexOf("\\");
            String strOnlyCurrentSecondFileName = objEARFilesComparingTool.strGlobleSecondEARFileName.substring(intSecondFileLastIndex);
            if(!(objEARFilesComparingTool.strGlobleSecondEARFileName.endsWith(strOnlyCurrentSecondFileName)))
            {
                strSecondFileNameForReport = objEARFilesComparingTool.strSecondParentFileName + strOnlyCurrentSecondFileName;
            }
            else
            {
                strSecondFileNameForReport = objEARFilesComparingTool.strSecondParentFileName;
            }
        }
        
        strbufTextReport.append("BASIC DETAILS");
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append("*************");
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append("Left File Name :- " + strFirstFileNameForReport);
        strbufTextReport.append(STR_DOUBLE_LINE);
        
        strbufTextReport.append("Right File Name :- " + strSecondFileNameForReport);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(objEARFilesComparingTool.intMissingFirstFileCount + "Files removed from " + strFirstFileNameForReport);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(objEARFilesComparingTool.intMissingSecondFileCount + "Files removed from " + strSecondFileNameForReport);
        strbufTextReport.append(STR_DOUBLE_LINE);
        if(objEARFilesComparingTool.intModifiedFileCount == 1)
        {
            strbufTextReport.append(objEARFilesComparingTool.intModifiedFileCount + " File is Modified");
        }
        else
        {
            strbufTextReport.append(objEARFilesComparingTool.intModifiedFileCount + " Files are Modified");
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(objEARFilesComparingTool.intSimilarFileCount + " Files are not modified");
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_STAR_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
    }
    
    
    public void generateAllFilesDetails()
    {
        //Code for Displaying all the details
        int intSize = objEARFilesComparingTool.vecFirstEARFilesContent.size();
        int intLineNumber = 1;
        String strFirstFileContent = null;
        String strFileCompareStatus = null;
        String strSecondFileContent = null;
        String strFileCompareDetails = null;
        String strFileCompareStatusCode = null;
        
        strbufTextReport.append("Full File Deails");
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_DASH_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        
        for(int i=0;i<intSize;i++)
        {
            strFirstFileContent = objEARFilesComparingTool.vecFirstEARFilesContent.get(i).toString();
            int intLength = strFirstFileContent.length();
            if(intLength < intBigFirstFileContentLength)
            {
                //Add Space
                int intNumberOfSpaceToAdd = intBigFirstFileContentLength - intLength;
                for(int j=0;j<intNumberOfSpaceToAdd;j++)
                {
                    strFirstFileContent += " ";
                }
            }
            
            strSecondFileContent = objEARFilesComparingTool.vecSecondEARFilesContent.get(i).toString();
            intLength = strSecondFileContent.length();
            if(intLength < intBigSecondFileContentLength)
            {
                //Add Space
                int intNumberOfSpaceToAdd = intBigSecondFileContentLength - intLength;
                for(int j=0;j<intNumberOfSpaceToAdd;j++)
                {
                    strSecondFileContent += " ";
                }
            }
            
            strFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            strFileCompareDetails = objEARFilesComparingTool.vecEqualityStatusDetails.get(i).toString();
            
            if(strFileCompareStatus.equals("EQUAL"))
            {
                objEARFilesComparingTool.intSimilarFileCount++;
                strFileCompareStatusCode = " = ";
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFirstFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareStatusCode);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strSecondFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareDetails);
                strbufTextReport.append(STR_SINGLE_LINE);
            }
            else if(strFileCompareStatus.equals("NOT EQUAL"))
            {
                objEARFilesComparingTool.intModifiedFileCount++;
                strFileCompareStatusCode = "<>"; 
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFirstFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareStatusCode);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strSecondFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareDetails);
                strbufTextReport.append(STR_SINGLE_LINE);
            }
            else if(strFileCompareStatus.equals("FILE MISSING"))
            {
                objEARFilesComparingTool.intMissingFirstFileCount++;
                strFileCompareStatusCode = " * ";
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFirstFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareStatusCode);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strSecondFileContent);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strFileCompareDetails);
                strbufTextReport.append(STR_DOUBLE_LINE);
            }
            intLineNumber++;
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
    }
    
    public void generateMissingFileDetails()
    {
        strbufTextReport.append("File Missing in " + strFirstFileNameForReport);
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_DASH_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        
        int intSize = objEARFilesComparingTool.vecFirstEARFilesContent.size();
        int intLineNumber = 1;
        String strFileContent = null;
        String strFileCompareStatus = null;
        
        for(int i=0;i<intSize;i++)
        {
            strFileContent = objEARFilesComparingTool.vecFirstEARFilesContent.get(i).toString();
            if(strFileContent.trim().length() == 0)
            {
                continue;
            }
            strFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            
            if(strFileCompareStatus.equals("FILE MISSING"))
            {   
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(strFileContent);
                strbufTextReport.append(STR_SINGLE_LINE);
                intLineNumber++;
            }                
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append("File Missing in " + strSecondFileNameForReport);
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_DASH_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);

        intSize = objEARFilesComparingTool.vecSecondEARFilesContent.size();
        intLineNumber = 1;
        strFileContent = null;
        strFileCompareStatus = null;
        for(int i=0;i<intSize;i++)
        {
            strFileContent = objEARFilesComparingTool.vecSecondEARFilesContent.get(i).toString();
            if(strFileContent.trim().length() == 0)
            {
                continue;
            }
            strFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            
            if(strFileCompareStatus.equals("FILE MISSING"))
            {
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(strFileContent);
                strbufTextReport.append(STR_SINGLE_LINE);
                intLineNumber++;
            }                
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_STAR_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
    }
    
    public void generateChangedFileDetails()
    {
        strbufTextReport.append("The Changed File Names and the change details are available below");
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_DASH_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);        
        
        int intSize = objEARFilesComparingTool.vecFirstEARFilesContent.size();
        int intLineNumber = 1;
        String strEARFileContent = null;
        String strEARFileCompareStatus = null;
        StringBuffer strbufEARCompareDetails = new StringBuffer(100);
        String strFirstEarFileSize = null;
        Date dateFirstEARFilesLastModifiedDate = null;
        String strSecondEarFileSize = null;
        Date dateSecondEARFilesLastModifiedDate = null; 
        String strSecondEARFikeModifiedDate = null;
        long longFirstEARFikeModifiedDate = 0;
        long longSecondEARFikeModifiedDate = 0;
            
        for(int i=0;i<intSize;i++)
        {
            strEARFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            
            if(strEARFileCompareStatus.equals("NOT EQUAL"))
            {
                strEARFileContent = objEARFilesComparingTool.vecFirstEARFilesContent.get(i).toString();
                strFirstEarFileSize = objEARFilesComparingTool.vecFirstEARFilesSize.get(i).toString();
                String strFirstEARFikeModifiedDate = objEARFilesComparingTool.vecFirstEARFilesLastModifiedDate.get(i).toString();
                longFirstEARFikeModifiedDate = Long.parseLong(strFirstEARFikeModifiedDate);
                dateFirstEARFilesLastModifiedDate = new Date(longFirstEARFikeModifiedDate);
                strSecondEarFileSize = objEARFilesComparingTool.vecSecondEARFilesSize.get(i).toString();
                
                strSecondEARFikeModifiedDate = objEARFilesComparingTool.vecSecondEARFilesLastModifiedDate.get(i).toString();
                longSecondEARFikeModifiedDate = Long.parseLong(strSecondEARFikeModifiedDate);
                dateSecondEARFilesLastModifiedDate = new Date(longSecondEARFikeModifiedDate);
                
                strbufEARCompareDetails.append(STR_TAB)
                    .append("The size of the file in ")
                    .append(strFirstFileNameForReport)
                    .append(" is ").append(strFirstEarFileSize)
                    .append(" and last modified on ").append(dateFirstEARFilesLastModifiedDate + STR_SINGLE_LINE);
                
                strbufEARCompareDetails.append(STR_TAB)
                    .append("The size of the file in ")
                    .append(strSecondFileNameForReport)
                    .append(" is ").append(strSecondEarFileSize)
                    .append(" and last modified on ").append(dateSecondEARFilesLastModifiedDate);
                
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strEARFileContent + " is modified with the following comparison details");
                strbufTextReport.append(STR_SINGLE_LINE);
                strbufTextReport.append(strbufEARCompareDetails);
                strbufTextReport.append(STR_DOUBLE_LINE);
                strbufTextReport.append(STR_DOUBLE_LINE);
                
                intLineNumber++;
                strbufEARCompareDetails.delete(0, strbufEARCompareDetails.length());
            }
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_STAR_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
    }
    
    public void generateSimilarFileDetails()
    {
        strbufTextReport.append("Following are the similar files");
        strbufTextReport.append(STR_SINGLE_LINE);
        strbufTextReport.append(STR_DASH_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        
        int intSize = objEARFilesComparingTool.vecFirstEARFilesContent.size();
        int intLineNumber = 1;
        String strEARFileContent = null;
        String strEARFileCompareStatus = null;
        for(int i=0;i<intSize;i++)
        {
            strEARFileCompareStatus = objEARFilesComparingTool.vecEqualityStatus.get(i).toString();
            
            if(strEARFileCompareStatus.equals("EQUAL"))
            {
                strEARFileContent = objEARFilesComparingTool.vecFirstEARFilesContent.get(i).toString();
                
                strbufTextReport.append(intLineNumber);
                strbufTextReport.append(STR_TAB);
                strbufTextReport.append(strEARFileContent);
                strbufTextReport.append(STR_SINGLE_LINE);
                intLineNumber++;
            }         
        }
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_STAR_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
        strbufTextReport.append(STR_DOUBLE_LINE);
    }
}